<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>采购退货</title>
<script type="text/javascript">
$(function () {
	

    //1.初始化Table
    var oTable = new TableInit();
    oTable.Init();

    //2.初始化Button的点击事件
    var oButtonInit = new ButtonInit();
    oButtonInit.Init();
    
    
    $('#btn_add').click(function () {
    	
    	window.location.href='${pageContext.request.contextPath }/pages/cb/returngoods.jsp_insert.jsp';
    	
    });
    
});


var TableInit = function () {
    var oTableInit = new Object();
    //初始化Table
    oTableInit.Init = function () {
        $('#tb_departments').bootstrapTable({
            url: '${pageContext.request.contextPath }/demo.do',         //请求后台的URL（*）
            method: 'get',                      //请求方式（*）
            toolbar: '#toolbar',                //工具按钮用哪个容器
            striped: true,                      //是否显示行间隔色
            cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
            pagination: true,                   //是否显示分页（*）
            sortable: false,                     //是否启用排序
            sortOrder: "asc",                   //排序方式
            queryParams: oTableInit.queryParams,//传递参数（*）
            sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
            pageNumber:1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 20, 30],        //可供选择的每页的行数（*）
            search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
            strictSearch: false,
            showColumns: false,                  //是否显示所有的列
            showRefresh: false,                  //是否显示刷新按钮
            minimumCountColumns: 2,             //最少允许的列数
            clickToSelect: true,                //是否启用点击选中行
            height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            showToggle:false,                    //是否显示详细视图和列表视图的切换按钮
            cardView: false,                    //是否显示详细视图
            detailView: false,                   //是否显示父子表
            columns: [{
                checkbox: true
            }, {
                field: 'id',
                title: '退货编号'
            }, {
                field: 'name',
                title: '退货日期'
            }, {
                field: 'pass',
                title: '供应商'
            }, {
                field: 'address',
                title: '物料名称'
            }, {
            	field: 'address1',
                title: '型号'
            },{
            	field: 'address2',
                title: '退货数量'
            },{
            	field: 'address3',
                title: '退货原因'
            },{
            	field: 'address4',
                title: '退货金额'
            },{
            	field: 'address5',
                title: '状态'
            },{
            	field: 'address6',
                title: '审批状态'
            }]
        });
    };

    //得到查询的参数
    oTableInit.queryParams = function (params) {
        var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            limit: params.limit,   //页面大小
            offset: params.offset,  //页码
            departmentname: $("#txt_search_departmentname").val(),
            statu: $("#txt_search_statu").val()
        };
        return temp;
    };
    return oTableInit;
};


var ButtonInit = function () {
    var oInit = new Object();
    var postdata = {};

    oInit.Init = function () {
        //初始化页面上面的按钮事件
    };

    return oInit;
};


</script>
<script type="text/javascript">
 $(function () {
	$(".form_datetime").datetimepicker({
	 format: "yyyy-mm-dd",
	 autoclose: true,
	 todayBtn: true,
	 todayHighlight: true,
	 showMeridian: true,
	 pickerPosition: "bottom-left",
	 language: 'zh-CN',//中文，需要引用zh-CN.js包
	 startView: 2,//月视图
	 minView: 2//日期时间选择器所能够提供的最精确的时间选择视图
	 });
 });
</script>
<style type="text/css">
.my-container {
    float: left;
    display: inline-block;
    margin-right:30px;
}

.myLabel-content ,.myText-content,.myBtn-content{
    float: left;
    display: inline-block;
    margin-left: 10px;
}
.myLabel-content,.myText-content input[type='text'],.myBtn-content .btn {
    height: 30px;
    font-size: 12px;
}
.myBtn-content .btn {
    margin-bottom: 10px;
}
</style>
</head>
<body>
	<div class="panel-body" style="padding-bottom:0px;">
        <!--<div class="panel panel-default">
             <div class="panel-heading">查询条件</div>
            <div class="panel-body">
                <form id="formSearch" class="form-horizontal">
                    <div class="form-group" style="margin-top:15px">
                        <label class="control-label col-sm-1" for="txt_search_departmentname">退货日期:</label>
                        <div class="col-sm-1">
                            <select id="txt_search_departmentname" name="materienumber" class="selectpicker show-tick form-control"  data-live-search="false">
	                         <option>最近一天</option>
	                         <option>最近一星期</option>
	                         <option>最近一个月</option>
                         </select>
                        </div>
                        <label class="control-label col-sm-1" for="txt_search_statu" style="width: 30px;">从</label> 
                        <div class="col-sm-2">
                        	<input class="form_datetime form-control" type="text" id="arrtimeUpdat" name="arrtime" readonly >
                        </div>
                        <label class="control-label col-sm-1" for="txt_search_statu" style="width: 30px;padding-left: 0px;">至</label> 
                        <div class="col-sm-2" style="padding-left: 0px;">
                        	<input class="form_datetime form-control"  type="text" id="arrtimeUpdat" name="arrtime" readonly >
                        </div>
                        
                        <label class="control-label col-sm-1" for="txt_search_departmentname">相关单位:</label>
                        <div class="col-sm-1">
                            <select id="txt_search_departmentname" name="materienumber" class="selectpicker show-tick form-control"  data-live-search="false">
	                         <option>所有客户</option>
                         </select>
                        <div class="col-sm-1" style="text-align:left;">
                            <button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary">查询</button>
                        </div>
                        </div>
                    </div>
                </form>
            </div> 
        </div>   -->    

		   <div id="toolbar">
		    <div class="my-container">
		        <label class="myLabel-content" style="margin-left: 0px;">日期：</label>
		        <div class="myText-content">
		            <select id="txt_search_departmentname" name="materienumber" class="selectpicker show-tick form-control"  data-live-search="false">
                        <option>最近一天</option>
                        <option>最近一星期</option>
                        <option>最近一个月</option>
                    </select>
		        </div>
		    </div>
		    <div class="my-container">
		        <label class="myLabel-content">从</label>
		        <div class="myText-content">
		            <input class="form_datetime form-control" type="text" id="arrtimeUpdat" name="arrtime" readonly >
		        </div>
		        <label class="myLabel-content">至</label>
		        <div class="myText-content">
		            <input class="form_datetime form-control" type="text" id="arrtimeUpdat" name="arrtime" readonly >
		        </div>
		    </div>
		    
		    <div class="my-container" style="text-align:left;">
		        <label class="myLabel-content">相关单位：</label>
		        <div class="myText-content">
		            <select id="txt_search_departmentname" name="materienumber" class="selectpicker show-tick form-control"  data-live-search="false">
                        <option>所有的客户</option>
                    </select>
		        </div>
		    </div>
		    
		    <div class="myBtn-content">
		        <button id="search" type="button" class="btn btn-primary">搜索</button>
		        <button id="reset" type="button" class="btn btn-default">重置</button>
		    </div>
        </div>


        <div id="toolbar" class="btn-group">
            <button id="btn_add" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
            </button>
            <button id="btn_edit" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
            </button>
            <button id="btn_delete" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
            </button>
            &nbsp;
            <button id="btn_add1" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-phone" aria-hidden="true"></span>审批
            </button>
            <button id="btn_add2" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-phone" aria-hidden="true"></span>批量审批
            </button>
            <button id="btn_edit" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>撤销审批
            </button>
            <button id="btn_delete" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-tasks" aria-hidden="true"></span>导出
            </button>
            <button id="btn_delete" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-send" aria-hidden="true"></span>退货处理
            </button>
        </div>
     
        <table id="tb_departments"></table>
    </div>
</body>
</html>